#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
int num,od,n,a[N],op=0;
int main()
{
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	cin>>n;
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	num=n;
	while(num){
		op=1;
		while(a[op]==-1){
			op++;
		}
		od=a[op];
		for(int i=op;i<=n;i++){
			cout<<i<<" ";
			num--;
			a[i]=-1;
			while(a[i+1]==od||a[i+1]==-1)
				i++;
			od=a[i+1];
		} 
		cout<<endl;
	}
	return 0;
}
